-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce memory usage in CG #130
Reduce memory usage in CG #130
Conversation
Codecov Report
@@ Coverage Diff @@
## master #130 +/- ##
==========================================
- Coverage 86.54% 86.29% -0.25%
==========================================
Files 18 18
Lines 1390 1394 +4
==========================================
Hits 1203 1203
- Misses 187 191 +4
Continue to review full report at Codecov.
|
Since there's a test for this, it's fine to change as long as it passes the test. Without that check it used to return all-NaN, but presumably your fix of the starting-point-at-solution bug fixed this. |
I think the NaN result is a bug in the current implementation because the initial residual is not checked. With If |
Removing If I remember correctly there was an idea to remove |
@haampie can you leave KrylovSubspace dependency as it was and rebase? To not delay this PR's merge unnecessarily and then we can discuss KrylovSubspace in general for the package. |
This PR doesn't remove the |
b91b131
to
9988fd9
Compare
Yeah the issue is about removing it's usage in cg, not about removing the type from the package. As I explained before:
So the intention was to make cg accept krylovsubspace as input in the future. If we remove it then it can't be done and it should be in a separate issue. |
Alright, fixed that |
Just for reference, I did a comparison with Trilinos.jl, resulting in the following for CG:
I attempted to reproduce your benchmark as accurately as possible here: |
Thanks @barche for taking the time to do that. It'll serve as a good performance goal to keep in mind! That shows we're already pretty close to Trillinos which is awesome! |
Is Trilinos multithreading the sparse matrix vector multiplication? If it is, one could try using something like https://github.com/JuliaSparse/MKLSparse.jl or https://github.com/dcjones/RecursiveSparseBlocks.jl to see if it is the matvec that makes the difference. |
@barche did you run Julia with multithreading enabled? In my experience the Julia version runs somewhat faster if you do |
@KristofferC No, Trilinos was not multithreading. I'll do some more tests using that when I get back to one of my desktop machines. @haampie I kept the Julia settings at their default, but switching off threading made no noticeable difference on this 2012 Macbook Air. |
* Reduce memory usage in CG * Bring back Krylov subspace again * Fix deprecation warning
* Reduce memory usage in CG * Bring back Krylov subspace again * Fix deprecation warning
A_mul_B!
for matrix-vector products. Since we're switching to LinearMaps this shouldn't be a problem.b
are zero. I would say CG should not be responsible for this.Benchmark results:
This PR
Current implementation